<?php
namespace app\index\controller;
use think\Controller;
use app\index\model\Fz;
	class Sys extends Controller
	{
		public function index(){
			echo "hello world";
		}
		public function fz(){
			\header("Access-Control-Allow-Origin:http://localhost:8080");
			$index=input("get.val");
			$f=new Fz();
			if(!empty($index)){				
				$number=$index-1;
				$data=$f->sel($number);
				return json($data);
			}
			else{
				$index=0;
				$data=$f->sel($index);
				return json($data);
			}
		
		}
		public function upload(){
			\header("Access-Control-Allow-Origin:http://localhost:8080");
			$data['val']=$_FILES['val'];
			$path="./img/".$_FILES['val']['name'];
			if(\move_uploaded_file($_FILES['val']['tmp_name'],$path)){
				$data['success']="成功";
				$data['url']="http://localhost:8082/tp5/publica/img/".$_FILES['val']['name'];
			}
			else{
				$data['success']="失败";
			}
			return \json($data);
			}
	}
